﻿using System;
using System.Windows.Forms;
using MediaController.Client.Controls.UserControls;
using MediaController.Configuration;
using MediaController.Configuration.Interfaces;

namespace MediaController.Client.Controls.Dialogs
{
    public partial class PropertiesForm : Form
    {
        public PropertiesForm()
        {
            InitializeComponent();         
        }

        #region Private Methods

        private void PropertiesForm_Load(object sender, EventArgs e)
        {            
            _treeViewExplorer.SelectedNode = _treeViewExplorer.Nodes[0];
        }

        private void TreeViewExplorerAfterSelect(object sender, TreeViewEventArgs e)
        {
            switch (e.Node.Text)
            {
                case "Watch Folders":
                    ShowControl(  new WatchFolders());
                    break;
                case "Advance":
                    _treeViewExplorer.SelectedNode = e.Node.FirstNode;
                    break;
                case "Regex":
                    ShowControl(new RegexManager());
                    break;
                case "Paths":
                    ShowControl(new PathManager());
                    break;
                case "Categories":
                    ShowControl(new Categories());
                    break;
            }
        }

        private void ShowControl(Control control)
        {
            splitContainer1.Panel2.Controls.Clear();
            
            splitContainer1.Panel2.Controls.Add(control);
            control.Dock = DockStyle.Fill;
        }
        
        #endregion
    }
}